#define  _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int bin_search(int arr[], int l, int r, int k)
{
	int n=-1 ;
	while (l<=r)
	{
		int mid = (l + r) / 2;//也可以写成int mid = l+((r-l)>>1);
		if (k< arr[mid])
		{
			r = mid - 1;
		}
		if (k > arr[mid])
		{
			l = mid + 1;
		}
		if (k == arr[mid])
		{
			n = mid;
			break;
		}
		
	}
	return n;
}
int main()
{
	int arr[] = { 1,2,3,4,5,6 };
	int key=0;
	int sz = sizeof(arr) / sizeof(arr[0]);
	int left = 0;
	int right = sz - 1;
	scanf("%d", &key);
	int a=bin_search(arr, left, right, key);
	printf("%d", a);
	return 0;
}